/*
 * Copyright 2009 Eat Local Food, LLC
 * Copyright (c) 2007 osCommerce (this file was written after
 * code review of osCommerce).
 *
 * This file is part of gwtCommerce.
 *
 * gwtCommerce is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * gwtCommerce is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gwtCommerce.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.elf.gwt.common.client.model;

import com.google.gwt.json.client.JSONObject;

/**
 *  
 */
public class TermsAndConditionsModel extends AbstractModel
{
	protected int id;
	protected int labelId;
	protected String label;
	protected String summary;
	protected String text;
	protected String textEdit;
	protected boolean required;
	protected int sortOrder;
	
	public TermsAndConditionsModel() 
	{
		id = -1;
		labelId = -1;
		label = "";
		summary = "";
		text = "";
		textEdit = "";
		required = false;
		sortOrder = 0;
	}
	
	public TermsAndConditionsModel(JSONObject jsonObject)
	{
		id = convertToInteger(jsonObject, "id");
		labelId = convertToInteger(jsonObject, "label_id");
		label = convertToString(jsonObject, "label");
		summary = convertToString(jsonObject, "summary");
		text = convertToString(jsonObject, "text");
		textEdit = convertToString(jsonObject, "text_edit");
		required = convertToBoolean(jsonObject, "required");
		sortOrder = convertToInteger(jsonObject, "sort_order");
	}	
	
	public TermsAndConditionsModel(TermsAndConditionsModel model) 
	{
		id = model.getId();
		labelId = model.getLabelId();
		label = model.getLabel();
		summary = model.getSummary();
		text = model.getText();
		textEdit = model.getTextEdit();
		required = model.isRequired();
		sortOrder = model.getSortOrder();
	}

	public int getId() {
		return id;
	}

	public int getLabelId() {
		return labelId;
	}

	public String getLabel() {
		return label;
	}

	public String getSummary() {
		return summary;
	}

	public String getText() {
		return text;
	}

	public String getTextEdit() {
		return textEdit;
	}

	public boolean isRequired() {
		return required;
	}

	public int getSortOrder() {
		return sortOrder;
	}
}
